#pragma once

#include "../ModuleBase.h"
#include "CommonStruct.h"

#include <functional>
#include <map>

struct cJSON;

using WebRequstHandlerType = std::function<int(cJSON*, std::string&)>;
using WebRegisterRequstHandlerType = std::function<int(const WebAPIPermission, cJSON*, std::string&)>;

int MapServerFunc(const std::string& strWebReq, const std::string& strJsonBuffer, std::string& strStructBuffer);


class WebModule :public ModuleBase
{
public:
    virtual bool InitModule() override;

    bool RegisterWebInterface( const std::string& request_target, WebRegisterRequstHandlerType handler, const WebAPIPermission permission);

    static WebModule& Get();

private:
};